import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { EmployeeVO, EmployeeForm, EmployeeQuery } from '@/api/canteen/employee/types';
/**
 * 查询从业人员管理列表
 * @param query
 * @returns {*}
 */

export const listEmployee = (query?: EmployeeQuery): AxiosPromise<EmployeeVO[]> => {
  return request({
    url: '/canteen/employee/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询从业人员管理详细
 * @param employeeId
 */
export const getEmployee = (employeeId: string | number): AxiosPromise<EmployeeVO> => {
  return request({
    url: '/canteen/employee/' + employeeId,
    method: 'get'
  });
};

/**
 * 新增从业人员管理
 * @param data
 */
export const addEmployee = (data: EmployeeForm) => {
  return request({
    url: '/canteen/employee',
    method: 'post',
    data: data
  });
};

/**
 * 修改从业人员管理
 * @param data
 */
export const updateEmployee = (data: EmployeeForm) => {
  return request({
    url: '/canteen/employee',
    method: 'put',
    data: data
  });
};

/**
 * 删除从业人员管理
 * @param employeeId
 */
export const delEmployee = (employeeId: string | number | Array<string | number>) => {
  return request({
    url: '/canteen/employee/' + employeeId,
    method: 'delete'
  });
};
